package io.xxx.walle.room;

import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class RoomGroupService {

    @Resource
    private RoomRepository roomRepository;

    @Resource
    private RoomGroupRepository roomGroupRepository;

    @Resource
    private RoomMapper roomMapper;

    public void addRooms(RoomGroup roomGroup) {
        List<Long> roomIds = roomGroup.getRooms()
                .stream()
                .map(Room::getId)
                .toList();
        if (!roomIds.isEmpty()) {
            roomMapper.updateRoomGroup(roomGroup.getId(), roomIds);
        }
    }
}
